using Autofac;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Xlit.Example.Business.IOC;
using Xlit.Example.Business.Mapper;
using Xlit.Example.Data;
using Xlit.Project.Mvc;

namespace Xlit.Example
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<ExampleDbContext>();
            services.AddXlitConfigure();
        }

        public void ConfigureContainer(ContainerBuilder containerBuilder)
        {
            containerBuilder.RegisterModule<DefaultModule>();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAutoMapper();
            app.UseXlitConfigure();
        }
    }
}
